package com.sxit.tdf.server.controller;

import cn.dev33.satoken.stp.StpUtil;
import com.sxit.tdf.server.entity.bo.ComplexFileMessageBo;
import com.sxit.tdf.server.response.R;
import com.sxit.tdf.server.service.IFileService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;

/**
 * @author 胡乖乖童鞋
 * @date 2022/3/15 15:27
 * @describe
 */
@RestController
@RequestMapping("/file-message")
@Tag(name = "FileMessageController", description = "文件展示信息接口")
public class FileMessageController {

  @Autowired private IFileService fileService;

  @Operation(summary = "获取文件信息接口")
  @GetMapping("/getFileMessage")
  public R getFileMessage() {

    ComplexFileMessageBo message = fileService.getMessage();

    return R.ok().put("data", message);
  }

  @Operation(summary = "获取个人文件列表信息数据")
  @GetMapping("/getPrivateFileInfoMsg")
  public R getPrivateFileInfoMsg() {

    HashMap map = fileService.getPrivateFileInfoMsg(StpUtil.getLoginIdAsString());

    return R.ok().put("data", map);
  }
}
